Telegram Group & Telegram Channel
πŸ‘©β€πŸ’» Π§Ρ‚ΠΎ Ρ‚Π°ΠΊΠΎΠ΅ ΠΌΠ΅Ρ‚ΠΎΠ΄ map() Π² JavaScript ΠΈ ΠΊΠ°ΠΊ ΠΎΠ½ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ?

map() β€” это ΠΌΠ΅Ρ‚ΠΎΠ΄ массивов Π² JavaScript, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ создаёт Π½ΠΎΠ²Ρ‹ΠΉ массив, примСняя Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ ΠΊ ΠΊΠ°ΠΆΠ΄ΠΎΠΌΡƒ элСмСнту исходного. Он Π½Π΅ измСняСт ΠΎΡ€ΠΈΠ³ΠΈΠ½Π°Π»ΡŒΠ½Ρ‹ΠΉ массив.

➑️ ΠŸΡ€ΠΈΠΌΠ΅Ρ€:

const numbers = [1, 2, 3, 4];

// Π£ΠΌΠ½ΠΎΠΆΠ°Π΅ΠΌ ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ элСмСнт Π½Π° 2
const doubled = numbers.map(num => num * 2);

console.log(doubled); // [2, 4, 6, 8]


πŸ—£οΈ Π’ этом ΠΏΡ€ΠΈΠΌΠ΅Ρ€Π΅:

β€’ map() примСняСт Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ ΠΊΠΎ всСм элСмСнтам массива
β€’ ВозвращаСтся Π½ΠΎΠ²Ρ‹ΠΉ массив с Ρ€Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚Π°ΠΌΠΈ
β€’ Часто ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ для форматирования Π΄Π°Π½Π½Ρ‹Ρ… ΠΏΠ΅Ρ€Π΅Π΄ Π²Ρ‹Π²ΠΎΠ΄ΠΎΠΌ.

➑️ map() β€” основа Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»ΡŒΠ½ΠΎΠ³ΠΎ ΠΏΠΎΠ΄Ρ…ΠΎΠ΄Π° Π² Ρ€Π°Π±ΠΎΡ‚Π΅ с массивами

CodeBase | Frontend | #JS
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/codebase_frontend/705
Create:
Last Update:

πŸ‘©β€πŸ’» Π§Ρ‚ΠΎ Ρ‚Π°ΠΊΠΎΠ΅ ΠΌΠ΅Ρ‚ΠΎΠ΄ map() Π² JavaScript ΠΈ ΠΊΠ°ΠΊ ΠΎΠ½ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ?

map() β€” это ΠΌΠ΅Ρ‚ΠΎΠ΄ массивов Π² JavaScript, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ создаёт Π½ΠΎΠ²Ρ‹ΠΉ массив, примСняя Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ ΠΊ ΠΊΠ°ΠΆΠ΄ΠΎΠΌΡƒ элСмСнту исходного. Он Π½Π΅ измСняСт ΠΎΡ€ΠΈΠ³ΠΈΠ½Π°Π»ΡŒΠ½Ρ‹ΠΉ массив.

➑️ ΠŸΡ€ΠΈΠΌΠ΅Ρ€:

const numbers = [1, 2, 3, 4];

// Π£ΠΌΠ½ΠΎΠΆΠ°Π΅ΠΌ ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ элСмСнт Π½Π° 2
const doubled = numbers.map(num => num * 2);

console.log(doubled); // [2, 4, 6, 8]


πŸ—£οΈ Π’ этом ΠΏΡ€ΠΈΠΌΠ΅Ρ€Π΅:

β€’ map() примСняСт Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ ΠΊΠΎ всСм элСмСнтам массива
β€’ ВозвращаСтся Π½ΠΎΠ²Ρ‹ΠΉ массив с Ρ€Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚Π°ΠΌΠΈ
β€’ Часто ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ для форматирования Π΄Π°Π½Π½Ρ‹Ρ… ΠΏΠ΅Ρ€Π΅Π΄ Π²Ρ‹Π²ΠΎΠ΄ΠΎΠΌ.

➑️ map() β€” основа Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»ΡŒΠ½ΠΎΠ³ΠΎ ΠΏΠΎΠ΄Ρ…ΠΎΠ΄Π° Π² Ρ€Π°Π±ΠΎΡ‚Π΅ с массивами

CodeBase | Frontend | #JS

BY CodeBase | Frontend


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/codebase_frontend/705

View MORE
Open in Telegram


CodeBase | Frontend Telegram | DID YOU KNOW?

Date: |

NEWS: Telegram supports Facetime video calls NOW!

Secure video calling is in high demand. As an alternative to Zoom, many people are using end-to-end encrypted apps such as WhatsApp, FaceTime or Signal to speak to friends and family face-to-face since coronavirus lockdowns started to take place across the world. There’s another optionβ€”secure communications app Telegram just added video calling to its feature set, available on both iOS and Android. The new feature is also super secureβ€”like Signal and WhatsApp and unlike Zoom (yet), video calls will be end-to-end encrypted.

Telegram hopes to raise $1bn with a convertible bond private placement

The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.

CodeBase | Frontend from ca


Telegram CodeBase | Frontend
FROM USA